<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/10
 * Time: 15:20
 */
namespace app\api\controller;

use app\common\controller\Api;

class Jdopen extends Api{
	protected $noNeedLogin = ['auth'];
	protected $noNeedRight = '*';
	
	
	protected $appKey = '130ED396076F3B2D252B420F80DC81F8';
	protected $appSecret = '0e93eea2357d47f08c40af4ae206c1d5';
	protected $redirectUrl = 'https://yunlsc.yunxin123.com/api/jdopen/auth';
	protected $token = '121d651e-1a7c-46d1-80f5-0d5f632d01b1';
	
	public function auth(){
		header("Content-type:text/html;charset=utf-8");
		$url = 'https://auth.360buy.com/oauth/token?grant_type=authorization_code&client_id='.$this->appKey.'&redirect_uri='.$this->redirectUrl.'&code='.input('code').'&state='.input('state').'&client_secret='.$this->appSecret;
		echo $url;
		$res = curlGetInfo($url, 'post', '', 30, false);
		dump($res);
		dump(json_decode($res,true));
	}
}